package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.system.pojo.SysRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 黑马程序员
 * @Company http://www.ithiema.com
 * @Version 1.0
 */
public interface SysRoleMapper extends BaseMapper<SysRole> {

    @Select("select * from sys_role where id " +
            "in(select role_id from sys_company_user_role " +
            "where company_user_id = #{userId} and company_id = #{companyId})")
    public List<SysRole> queryRolesByUserIdAndCompanyId(
            @Param("userId") Long userId, @Param("companyId") Long companyId);
}
